package com.mywork.service;

import org.springframework.ui.Model;

public class ShowInformation {
	/**
	 * 传入信息 自动添加信息页面的model
	 * @param model
	 * @param information 需要显示的信息
	 * @param buttonName 按钮名
	 * @param buttonAddress	需要跳转的地址
	 * @param buttonClass	提示的类别1:危险，2：还好，3：警告，4：成功
	 */
	public static void forInformation(Model model,String information,String buttonName,String buttonAddress,int buttonClass){
		model.addAttribute("information", information);
		model.addAttribute("buttonName", buttonName);
		model.addAttribute("buttonAddress", buttonAddress);
		switch (buttonClass) {
		case 1:
			model.addAttribute("buttonClass", "alert-danger");
			break;
		case 2:
			model.addAttribute("buttonClass", "alert-info");
			break;
		case 3:
			model.addAttribute("buttonClass", "alert-warning");
			break;
		case 4:
			model.addAttribute("buttonClass", "alert-success");
			break;
		

		default:
			model.addAttribute("buttonClass", "alert-danger");
			break;
		}
		
	}
}
